﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ArticleContentCreate.WebSite;
using ArticleContentCreate.WebSite.Pixiv.PixivArt;

namespace ArticleContentCreate.ViewManger
{
    public partial class PixivArtControl : UserControl
    {
        public PixivArtControl()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            WebSiteStaticvlaue.ArticleInfo info = new PArtHelper().GetArticleInfo(textBox1.Text);
            textBox2.Text = info.Title;
            richTextBox1.Text = info.Content;
        }

        private void textBox2_Click(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(textBox2.Text);
        }

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            Clipboard.SetDataObject(richTextBox1.Text);
        }

        private void PixivArtControl_DragDrop(object sender, DragEventArgs e)
        {
            try {
  string[] filePaths = (string[])e.Data.GetData(DataFormats.FileDrop);//拖放的多个文件的路径列表
                this.textBox1.Text =new PArtHelper().GetArtId(filePaths[0]);
            } catch { }
        }

        private void PixivArtControl_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Link;
            else e.Effect = DragDropEffects.None;
        }
    }
}